package com.itheima.thread.blockingqueue.demo02;

import java.util.concurrent.ArrayBlockingQueue;

public class BoxDemo {

    public static void main(String[] args) {

        // 1. 创建一个阻塞对象
        ArrayBlockingQueue<Box> arrayBlockingQueue = new ArrayBlockingQueue<Box>(1) ;

        // 2. 创建生产者线程的任务类对象
        ProducerThread producerThread = new ProducerThread(arrayBlockingQueue) ;

        // 3. 创建消费者线程的任务类对象
        CustomerThread customerThread = new CustomerThread(arrayBlockingQueue) ;

        // 4. 创建生产者线程对象
        Thread t1 = new Thread(producerThread) ;

        // 5. 创建消费者线程对象
        Thread t2 = new Thread(customerThread) ;

        // 6. 启动线程
        t1.start();
        t2.start();

    }

}
